import 'package:json_annotation/json_annotation.dart';

part 'message.g.dart';

@JsonSerializable()
class MessageModel {
  String title;

  String introduce;

  String date;

  MessageModel({required this.title, required this.introduce, required this.date});

  factory MessageModel.fromJson(Map<String, dynamic> json) => _$MessageModelFromJson(json);

  Map<String, dynamic> toJson() => _$MessageModelToJson(this);

  @override
  String toString() {
    return toJson().toString();
  }
}

@JsonSerializable()
class MessageTradeModel {
  String title;

  String date;

  String remark;

  MessageTradeModel({required this.title, required this.date, required this.remark});

  factory MessageTradeModel.fromJson(Map<String, dynamic> json) =>
      _$MessageTradeModelFromJson(json);

  Map<String, dynamic> toJson() => _$MessageTradeModelToJson(this);

  @override
  String toString() {
    return toJson().toString();
  }
}

@JsonSerializable()
class MessageNoticeModel {
  String title;

  String date;

  String remark;

  bool isActivity;

  String? from;

  MessageNoticeModel(
      {required this.title,
      required this.date,
      required this.remark,
      this.isActivity = false,
      this.from});

  factory MessageNoticeModel.fromJson(Map<String, dynamic> json) =>
      _$MessageNoticeModelFromJson(json);

  Map<String, dynamic> toJson() => _$MessageNoticeModelToJson(this);

  @override
  String toString() {
    return toJson().toString();
  }
}

@JsonSerializable()
class MessageInteractModel {
  String title;

  String date;

  String remark;

  String nickname;

  String from;

  MessageInteractModel({ required this.title, required this.date, required this.remark, required this.nickname, required this.from });

  factory MessageInteractModel.fromJson(Map<String, dynamic> json) =>
      _$MessageInteractModelFromJson(json);

  Map<String, dynamic> toJson() => _$MessageInteractModelToJson(this);

  @override
  String toString() {
    return toJson().toString();
  }
}
